package com.cc8w.api.service;

import com.cc8w.admins.mapper.RoleMapper;
import com.cc8w.entity.CategoryEntity;
import com.cc8w.entity.GoodsAttrEntity;
import com.cc8w.entity.GoodsEntity;
import com.cc8w.entity.ModelsEntity;
import com.cc8w.home.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

@Service("goodsService")
@Transactional
public class GoodsService {

    @Autowired
    @Qualifier("goodsMapper")
    private GoodsMapper goodsMapper;

    /**
     * 获取产品分类
     */
    public List<CategoryEntity> getGoodsCat(){
        return goodsMapper.getGoodsCat();
    }

    /**
     * 获取模型分类
     */
    public List<ModelsEntity> getModels(){
        return goodsMapper.getModels();
    }

    /**
     * 获得部分产品
     */
    public List<GoodsEntity> getGoods(){
        return goodsMapper.getGoods();
    }
    /**
     * 获得优惠产品
     */
    public List<GoodsEntity> getDiscountGoods(){
        return goodsMapper.getDiscountGoods();
    }
    /**
     * 获得某分类产品
     */
    public List<GoodsEntity> getGoodsListByCatId(int catId){
        return goodsMapper.getGoodsListByCatId(catId);
    }
    /**
     * 获得商品详情
     */
    public GoodsEntity getGoodsDetails(int goodsId){
        return goodsMapper.getGoodsDetails(goodsId);

    }
    /**
     * 查询产品对应的属性
     */
    public List<GoodsAttrEntity> getGoodsAttr(int goodsId){
        return goodsMapper.getGoodsAttr(goodsId);

    }

    /**
     * 属性对应的值数组
     */
    public void getGoodsAttrValues(){

    }
    /**
     * 获得产品价格
     */
    public BigDecimal getGoodsPrice(int goodsId, String goodsSn){
        return goodsMapper.getGoodsPrice(goodsId,goodsSn);
    }



}
